
<!-- BEGIN:main -->



<script>

    $(function() {
        $("#txtCreatedDate").datepicker({
            changeMonth: true,
            changeYear: true
        });

        $('input:radio[name="rdoFilePath"]').change(function() {
            if ($(this).is(':checked') && $(this).val() == 'youtube') {
                $("#txtVideo").removeAttr("disabled");
                $("#txtVideo").val('');
                $("#btBrowseVideo").hide();
            }
            else
            {
                $("#txtVideo").attr("disabled", "disabled");
                $("#txtVideo").val('');
                $("#btBrowseVideo").show();
            }
        });
    });

    function submitForm(ac)
    {

        var title = $('#txtTitle');
        var video = $('#txtVideo');

        var arrayInput = new Array(title, video);

        var hasError = validateEmptyValue(arrayInput);

        if (hasError) {
            alert('Vui lòng điền đầy đủ thông tin');
        } else {
            var form = document.phpForm;
            form.hdAction.value = ac;
            form.hdVideo.value = form.txtVideo.value;
            form.hdImage.value = form.txtImage.value;
            form.submit();
        }

    }






    function BrowseImage() {
        var finder = new CKFinder();
        finder.BasePath = '../blugin/ckeditor3.6.4/ckfinder/';
        finder.startupPath = "Images:/images/";
        finder.SelectFunction = SetImageField;
        finder.Popup();
    }


    function BrowseVideo() {
        var finder = new CKFinder();
        finder.BasePath = '../blugin/ckeditor3.6.4/ckfinder/';
        finder.startupPath = "Video:/video/";
        finder.SelectFunction = SetVideoField;
        finder.Popup();
    }

    function SetImageField(fileUrl) {
        document.getElementById('txtImage').value = fileUrl;
    }

    function SetVideoField(fileUrl) {
        document.getElementById('txtVideo').value = fileUrl;
    }


</script>




<div id="toolbar-box">
    <div class="d_divide5"></div>
    <div class="toolbar" id="toolbar">
        <table class="toolbar">
            <tbody>
                <tr>
                    <td class="button" id="toolbar-save">
                        <a href="javascript:void()" onclick="submitForm('addAndExit')" class="toolbar">
                            <span class="icon-32-save" title="Lưu và thoát">
                            </span>
                            Lưu và thoát
                        </a>
                    </td>

                    <td class="button" id="toolbar-apply">
                        <a href="javascript:void()" onclick="submitForm('add')" class="toolbar">
                            <span class="icon-32-apply" title="Lưu">
                            </span>
                            Lưu
                        </a>
                    </td>

                    <td class="button" id="toolbar-cancel">
                        <a href="./?com=com_video&task=view" class="toolbar">
                            <span class="icon-32-cancel" title="Hủy">
                            </span>
                            Hủy
                        </a>
                    </td>


                </tr>

            </tbody>
        </table>
    </div>

    <div class="header icon_48_video_add">
        Video: <small><small>[ Thêm mới ]</small></small><br>
    </div>
    <div class="d_divide5"></div>
</div>

<div class="d_divide10"></div>
<div class="d_clear"></div>

<div id="element-box">
    <form method="post" name="phpForm">
        <input type="hidden" id="hdAction" name="hdAction" value="" />
        <fieldset class="adminform">

            <legend>Thông tin video </legend>

            <div class="d_divide2"></div>

            <!--title-->
            <div>
                <label for="txtTitle" class="d_label">Tiêu đề: <b style="color: red;">*</b></label>
                <input class="d_text_input" name="txtTitle" id="txtTitle" title="tiêu đề đoạn video" type="text" size="50">
            </div>


            <div class="d_divide2"></div>

            <!--from youtube-->
            <div>
                <label for="" class="d_label">Nguồn file: </label> 
                <input name="rdoFilePath" id="rdoFilePath" value="server" class="inputbox" type="radio" checked="checked">
                Trên Server (máy chủ)
                <input name="rdoFilePath" id="rdoFilePath" value="youtube"  class="inputbox" type="radio">
                Trên Youtube
            </div>


            <div class="d_divide2"></div>

            <!--file path-->
            <div>
                <label for="txtVideo" class="d_label">Video file: <b style="color: red;">*</b></label>
                <input class="d_text_input"  type="text" id="txtVideo" name="txtVideo" value="" disabled="true" size="35" />
                <input id="btBrowseVideo" class="d_button" type="button" onClick="javascript:BrowseVideo();" value="Chọn" />
                <input type="hidden" id="hdVideo" name="hdVideo" value=""/>
            </div>


            <div class="d_divide2"></div>

            <!--image-->
            <div>
                <label class="d_label">Ảnh mô tả: </label>
                <input readonly="true" class="d_text_input" type="text" id="txtImage" name="txtImage" value="./{UPLOAD_FOLDER}/images/no_image.jpg" size="35" />
                <input class="d_button" type="button" onClick="javascript:BrowseImage();" value="Chọn" />
                <input type="hidden" id="hdImage" name="hdImage" value=""/>
            </div>





            <div class="d_divide2"></div>

            <!--created date--> 
            <div>
                <label for="txtCreatedDate" class="d_label">Ngày tạo: </label> 
                <input class="d_text_input" name="txtCreatedDate" id="txtCreatedDate" value="{TODAY}" size="15" maxlength="255" title="ngày video" type="text" readonly="true">
            </div>


            <div class="d_divide2"></div>

            <!--size-->
            <div>
                <label for="width" class="d_label">Rộng</label>
                <input style="float: left" class="d_text_input" onkeypress="return keypress(event);" type="text" size="10" value="250" name="txtWidth" id="width"> 
                <label for="height" class="d_label" style="width: 105px">Cao: </label>
                <input style="float: left" class="d_text_input" onkeypress="return keypress(event);" type="text" size="10" value="250" name="txtHeight" id="height">
            </div>


            <div class="d_divide2"></div>


            <div>
                <label class="d_label">Bật/Tắt: </label> 
                <input name="rdoStatus" id="rdoStatus1" value="0" class="inputbox" type="radio">
                Tắt
                <input name="rdoStatus" id="rdoStatus" value="1" checked="checked" class="inputbox" type="radio">
                Bật
            </div>




        </fieldset>

    </form>


</div>

<!-- END:main -->